package com.lm.activiti.boot.dto;

import com.google.common.collect.Lists;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * @author lm_jcf
 * @date 2019/12/25 15:08
 */
@Data
public class Animal implements Serializable {

    private int anInt;
    @NotNull
    private Integer integer;

    @NotNull(message = "参数缺失：名称不能为空")
    private String name;


    private Integer height;

    private List<String> nameList;

    @Valid // 查级联
    private List<Food> foodList;

    private Food food;

    public Animal() {
    }

    public Animal(String name, Integer height) {
        this.name = name;
        this.height = height;
    }

    public List<String> getNameList() {
        if (StringUtils.isNotBlank(name)) {
            nameList = Lists.newArrayList(name);
        }
        return nameList;
    }
}
